package main

import (
	"fmt"
	"net"
)

func main() {
	Listener, err := net.Listen("tcp", "localhost:8000")
	if err != nil {
		fmt.Println("net.Listen err = ", err)
		return
	}
	defer Listener.Close()

	for {
		conn, err := Listener.Accept()
		if err != nil {
			fmt.Println("Listener.Accept err = ", err)
			return
		}
		defer conn.Close()
		buf := make([]byte, 1024)
		for {
			n, err := conn.Read(buf)
			if err != nil {
				fmt.Println("conn.Read err = ", err)
				return
			}
			fmt.Println(string(buf[:n]))
		}
	}

}
